home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11642 < prev    next >
Encoding:
Text File  |  1996-08-05  |  778 b   |  34 lines

  1. Path: loria.fr!usenet
  2. From: roegel@loria.fr (Denis B. Roegel)
  3. Newsgroups: comp.lang.c
  4. Subject: scanf/gets interaction ?
  5. Date: 25 Mar 1996 17:05:14 GMT
  6. Organization: CRIN & INRIA-Lorraine - Nancy - FRANCE
  7. Message-ID: <4j6joa$6ve@muller.loria.fr>
  8. NNTP-Posting-Host: pandore.loria.fr
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset=iso-8859-1
  11. Content-Transfer-Encoding: 8bit
  12. X-newsreader: xrn 8.01
  13.  
  14. I have the following program:
  15.  
  16. #include <stdio.h>
  17.  
  18. main(){
  19. int n;
  20. char num[10];
  21. char*r;
  22. fflush(stdin);
  23. printf("n: ");scanf("%i",&n);
  24. printf("Numero ? ");r = gets(num);
  25. printf("Bien recu!\n");
  26. }
  27.  
  28. which I compile with gcc on SunOS. The program asks for a first number n which
  29. I enter. But I never get a chance of entering a second one. Why is this so ?
  30.  
  31. Thanks in advance,
  32.  
  33. Denis
  34.